package com.logistics.pick.entity.model;

import com.logistics.pick.entity.domain.Pick;
import com.logistics.pick.entity.domain.PickContainer;
import com.logistics.utils.tool.StringUtils;
import lombok.Data;

import java.util.List;

/**
 * <p>
 * 拣配单
 * </p>
 *
 * @author kaihan.wang
 * @since 2024-06-28
 */
@Data
public class PickRow {

    private Integer id;

    //单号
    private String code;

    //状态：0:拣配中,10:拣配完成,20:配送中,30:配送完成
    private String status;

    //ERP领料单号
//    private String erpInvbillCode;

    //优先级
    private String priority;

    private List<PickContainer> container;

    private Boolean isShow;

    public PickRow(){

    }

    public PickRow(Pick pick){
        this.id = pick.getId();
        this.code = pick.getCode();
        this.status = pick.getStatus().toString();
//        this.erpInvbillCode = pick.getErpInvbillCode();
//        this.priority = pick.getPriority().toString();
    }

    public static PickRow build(Pick pick){
        return new PickRow(pick);
    }

    public static PickRow build(String code, Integer status,Integer id, List<PickContainer> container, boolean isShow){
        PickRow pickRow = new PickRow();
        pickRow.setId(id);
        pickRow.setCode(code);
        pickRow.setStatus(StringUtils.isNotNull(status) ? status.toString() : "");
        pickRow.setContainer(container);
        pickRow.setIsShow(isShow);
        return pickRow;
    }

    public static PickRow build(String code, Integer status,Integer id, List<PickContainer> container){
        return PickRow.build(code, status, id, container, false);
    }
}
